﻿using SqlSugar;
using static DataModels.Enums.GeneralEnum;

namespace DataModels.Entities.HomeService
{
    /// <summary>
    /// 服务时间规则设置
    /// </summary>
    public class HomeServiceProductTimeRule
    {
        /// <summary>
        /// 规则ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public Guid UUID { get; set; } = Guid.NewGuid();

        /// <summary>
        /// 关联商品ID
        /// </summary>
        public Guid ProductUUID { get; set; }

        /// <summary>
        /// 规则名称
        /// </summary>
        public string RuleName { get; set; }

        /// <summary>
        /// 规则类型（1-固定日期，2-每周重复，3-每月重复）
        /// </summary>
        public int RuleType { get; set; }

        /// <summary>
        /// 生效开始日期
        /// </summary>
        public DateTime StartDate { get; set; }

        /// <summary>
        /// 生效结束日期（空表示永久生效）
        /// </summary>
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 星期掩码（二进制表示，如1111100表示周一至周五）
        /// </summary>
        public int WeekMask { get; set; } = 0;

        /// <summary>
        /// 时间段配置JSON
        /// </summary>
        public string TimeSlotsJson { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsEnabled { get; set; } = true;

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdateTime { get; set; }

        /// <summary>
        /// 删除标记
        /// </summary>
        public Status IsDeleted { get; set; } = Status.Disable;
    }

    /// <summary>
    /// 时间段配置
    /// </summary>
    public class TimeSlotConfig
    {
        /// <summary>
        /// 开始时间（HH:mm）
        /// </summary>
        public string StartTime { get; set; }

        /// <summary>
        /// 结束时间（HH:mm）
        /// </summary>
        public string EndTime { get; set; }

        /// <summary>
        /// 可预约数量
        /// </summary>
        public int AvailableSlots { get; set; }

        /// <summary>
        /// 是否全天
        /// </summary>
        public bool IsAllDay { get; set; } = false;

        /// <summary>
        /// 规则uuid
        /// </summary>
        public Guid? ProductTimeRuleUUID { get; set; }
    }
}